﻿#pragma once
#include "AsGraphicsBasics.h"

__AS_JY(Update 2023.1.7)
class AS_GRAPHICS_API AsGraphicsItem : public QGraphicsItem {
public:
	explicit AsGraphicsItem(QGraphicsItem *parent = nullptr);
	virtual ~AsGraphicsItem();

protected:
	QRectF mBoundingRect;
	QPen mPen;
	QBrush mBrush;
	bool mbKeepPenWidth;
	bool mbAntialiasing;

public:
	QRectF boundingRect() const override;

private:
	void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;

protected:
	virtual void paintPlus(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
	virtual void paint(QPainter* painter);

public:
	void setPen(const QPen& pen, bool keepPenWidth = false);
	void setBrush(const QBrush& brush);

public:
	void setEnable_KeepPenWidth(bool isEnable = true);
	void setEnable_Antialiasing(bool isEnable = true);

};
